<template>
        <div class="admin_gpsadv_adver_edit">
        <div class="box" :class="'box-'+theme">
            <div class="box-header with-border">
                <h3 class="box-title">{{$t('Quickly fill in')}}</h3>
            </div>
            <div class="box-body">
                <edit :options="options" ref="edit">
                    <template slot="content" slot-scope="props">
                        <div class="move-items col-lg-4 col-md-6 col-sm-12 col-xs-12">
                            <edit-item key-name="user_id" :options="{name: '用户ID',type:'text', rules:'',title:''}" :datas="props">
                            </edit-item>
                            <edit-item key-name="title" :options="{name: '广告标题',type:'text', rules:'required',title:''}" :datas="props">
                            </edit-item>
                            <edit-item key-name="expire_start_time" :options="{name: '广告开始时间',type:'text', rules:'required',title:''}" :datas="props">
                            </edit-item>
                        </div>
                        <div class="move-items col-lg-4 col-md-6 col-sm-12 col-xs-12">
                            <edit-item key-name="expire_end_time" :options="{name: '广告结束时间',type:'text', rules:'required',title:''}" :datas="props">
                            </edit-item>
<!--                            <edit-item key-name="banner_img" :options="{name: '广告图片',type:'text', rules:'required',title:''}" :datas="props">-->
<!--                              <template slot="input-item">-->
<!--                                <upload v-model="props.data.row['banner_img']"-->
<!--                                        :placeholder-value="'/dist/img/user_default_180.gif'"-->
<!--                                        :disabled="!props.url">-->
<!--                                </upload>-->
<!--                              </template>-->
<!--                            </edit-item>-->
                            <edit-item key-name="advers_url" :options="{name: '广告跳转地址',type:'text', rules:'required',title:''}" :datas="props">
                            </edit-item>
                        </div>
                        <div class="move-items col-lg-4 col-md-6 col-sm-12 col-xs-12">
                          <edit-item key-name="banner_img" :options="{name: '广告图片', rules:'required'}"  :datas="props">
                            <template slot="input-item">
                              <upload v-model="props.data.row['banner_img']"
                                      :placeholder-value="'/dist/img/user_default_180.gif'"
                                      :disabled="!props.url">
                              </upload>
                            </template>
                          </edit-item>
                        </div>
                    </template>
                </edit>
            </div>
        </div>
    </div>
</template>

<script>
    import {mapState, mapActions, mapMutations, mapGetters} from 'vuex';

    export default {
        components: {
            edit: ()=>import(/* webpackChunkName: "common_components/edit.vue" */ 'common_components/edit.vue'),
            editItem: ()=>import(/* webpackChunkName: "common_components/editItem.vue" */ 'common_components/editItem.vue'),
            select2:()=>import(/* webpackChunkName: "common_components/select2.vue" */ 'common_components/select2.vue'),
            upload:()=>import(/* webpackChunkName: "common_components/upload.vue" */ 'common_components/upload.vue'),
        },
        props: {
            url:{
                type: [String],
                default: function () {
                    return '';
                }
            },
            noBack:{
                type: [Boolean],
                default: function () {
                    return false;
                }
            },
            callback:{
                type: [Function],
                default: function () {
                    return function () {};
                }
            }
        },
        data() {
            return {
                options: {
                    lang_table:'gpsadv_advers', //字段翻译
                    id: 'edit', //多个组件同时使用时唯一标识
                    params: null, //默认筛选条件
                    url:this.url || '', //数据表请求数据地址
                    no_back:this.noBack,
                    callback: (response, row) => { //修改成功
                        this.callback();
                    }
                }
            };
        },
        methods: {},
        computed: {
            ...mapState([
                'use_url',
                'theme'
            ])
        },
        watch:{
            url(val){
                this.options.url = val;
            }
        }
    };
</script>
